<?php
header("Content-Type: text/html;charset=utf-8");
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/1
 * Time: 13:50
 *  from http://www.jb51.net/article/94395.htm
 */
include_once 'function.php';
//如果token为空则生成一个token
//
if (!isset($_SESSION['token']) || $_SESSION['token'] == '') {
    $token = getToken();
    session_start();
    $_SESSION['token'] = $token;
}


//var_dump($_SESSION);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="action.php" method="post">
    <input type="hidden" name="token" value="<?php echo $token ?>"/>
    <input type="submit" value="提交">
    <!-- 其他input submit之类的 -->
</form>
</body>
</html>
